package com.yuren.springbootLearn;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.context.ApplicationContext;

import java.util.List;


@SpringBootApplication
public class SpringbootLearnApplication {
    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(SpringbootLearnApplication.class, args);
        Binder binder = Binder.get(context.getEnvironment());

        FooProperties foo = binder.bind("com.yuren", Bindable.of(FooProperties.class)).get();
        System.out.println(foo.getFoo());

        List<String> post = binder.bind("com.yuren.post", Bindable.listOf(String.class)).get();

		List<PostInfo> posts = binder.bind("com.didispace.posts", Bindable.listOf(PostInfo.class)).get();
		System.out.println(posts);
        System.out.println(context.getEnvironment().containsProperty("com.yuren.database-platform"));
        System.out.println(context.getEnvironment().containsProperty("com.yuren.databasePlatform"));

    }
}
